package lab02.Test11;

import java.util.Scanner;

/**
 * Created by 星月 on 2017/10/25.
 */
public class Rectangle implements Printx{
    double width;
    double length;
    Rectangle(double width,double length){
        this.width=width;
        this.length=length;
    }
    //行为：求面积、求周长的方法
    public double getArea(){
        return width*length;
    }
    public double getLength(){
        return (width+length)*2.0;
    }
    @Override
    public void printMyWay() {
        System.out.println("该矩形的宽:width="+width+"长length="+length);
        System.out.println("该矩形的面积area="+getArea());
        System.out.println("该矩形的周长perimeter="+getLength());
    }


}
